package com.mvu.banana.common;

import com.mvu.banana.common.client.EvalService;
import com.mvu.banana.common.server.EvalServiceImpl;
import com.mvu.banana.domain.server.ServerProperties;
import com.mvu.banana.guest.server.SetupServlet;
import junit.framework.TestCase;
import org.fest.assertions.*;

import java.util.Date;
import java.util.List;

/**
 * Class description...
 *
 * @author mvu
 */
public abstract class ServerTestBase extends TestCase {
  static {
    ServerProperties.get().setProperty("javax.persistence.jdbc.url", "jdbc:h2:file:/tmp/mvu/banana-test");
    ServerProperties.get().setProperty("hibernate.hbm2ddl.auto", "create");
    new SetupServlet().init();
  }

  protected static final EvalService eval = new EvalServiceImpl();

  protected ObjectAssert assertThat(Object o){
    return Assertions.assertThat(o);
  }

  protected ListAssert assertThat(List<?> o){
    return Assertions.assertThat(o);
  }

  protected BooleanAssert assertThat(Boolean o){
    return Assertions.assertThat(o);
  }

  protected StringAssert assertThat(String o){
    return Assertions.assertThat(o);
  }

  protected IntAssert assertThat(Integer o){
    return Assertions.assertThat(o);
  }

  protected LongAssert assertThat(Long o){
    return Assertions.assertThat(o);
  }

  protected DateAssert assertThat(Date o){
    return new DateAssert(o);
  }
}
